package p25_控制器方法执行流程;

import lombok.Data;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;

@Configuration
public class WebConfig {

    @Controller
    public static class MyController {
        //这种控制器方法可以不走返回值处理器
        @ResponseStatus(HttpStatus.OK)
        public ModelAndView foo(Person p1, @ModelAttribute Person p2, @ModelAttribute String name) {
            System.out.println(p1);
            System.out.println(p2);
            return null;
        }
    }

    @Data
    public static class Person {
        private String name;
        private Integer age;
    }

}
